package com.fdd.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/books")
public class BookController {

    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    String getById(@PathVariable Integer id) {
        System.out.println("getById:" + id);
        return "{'code':0, 'msg':'getById'}";
    }

    @RequestMapping(method= RequestMethod.GET)
    String getAll() {
        System.out.println("getAll ...");
        return "{'code':0, 'msg':'getAll'}";
    }

    @RequestMapping(value = "/{id}", method = RequestMethod.POST)
    String setById(@PathVariable Integer id) {
        System.out.println("setById ..." + id);
        return "{'code':0, 'msg':'setById'}";
    }

    @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
    String delete(@PathVariable Integer id) {
        System.out.println("delete ..." + id);
        return "{'code':0, 'msg':'delete'}";
    }
}
